/*
 * WorkPage.h
 *
 *  Created on: 2010-12-9
 *      Author: wenjian
 */

#ifndef WORKPAGE_H_
#define WORKPAGE_H_

#include "../../commons.h"
#include "../../gdiplus/gdraw.h"

using namespace Ed;

namespace S {
  class WorkLayer;
  class ToolsLayer;
  class ControlLayer;
  class StatusLayer;
  class OperationLayer;

  class WorkPage: public Ed::DrawPage {
    public:
      /**
       * 工作模式
       */
        enum WorkMode{
          SelectMode,   //选择模式
          DrawEllipseMode, //画椭圆模式
          DrawRectangleMode //画矩形模式
      };

    public:
      WorkPage(HWND hWnd);
      virtual ~WorkPage();

      /**
       * 设置工作模式
       */
      void setWorkMode(WorkMode mode);

      /**
       * 返回工作模式
       */
      WorkMode getWorkMode(){
        return workMode;
      }

      WorkLayer* getWorkLayer(){
        return workLayer;
      }

      StatusLayer* getStatusLayer(){
        return statusLayer;
      }

      void switchToImageLayerMerger(){
        setLayerMerger(NULL);
      }

      void switchToBitbltLayerMerger(){
        setLayerMerger(bitbltLayerMerger);
      }

      void switchToTransparentBitbltLayerMerger(){
        setLayerMerger(transparentBitbltLayerMerger);
      }

    protected:
      void mousePressEvent(const MouseEvent* e);
      void mouseReleaseEvent(const MouseEvent* e);
      void mouseMoveEvent(const MouseEvent* e);

    private:
      //工作模式
      WorkMode workMode;

      //工作层
      WorkLayer* workLayer;
      //背景层
      Ed::Layer* backgroundLayer;
      //工具栏层
      ToolsLayer* toolsLayer;
      //控制层
      ControlLayer* controlLayer;
      //状态层
      StatusLayer* statusLayer;
      //参数操作层
      OperationLayer* operationLayer;

//      LayerMerger* layerMerger; //当前层合并器
      LayerMerger* bitbltLayerMerger;
      LayerMerger* transparentBitbltLayerMerger;
  };

}

#endif /* WORKPAGE_H_ */
